home *** CD-ROM | disk | FTP | other *** search
- class CCollisionBucket
- {
- var m_matrixX;
- var m_matrixY;
- var m_arrOverlappingBodies;
- function CCollisionBucket(matrixX, matrixY)
- {
- this.m_matrixX = matrixX;
- this.m_matrixY = matrixY;
- this.m_arrOverlappingBodies = new Array();
- }
- function get _matrixLocation()
- {
- return new Vector2D(this.m_matrixX,this.m_matrixY);
- }
- function AddBody(body)
- {
- FreshDebug.Assert(this.FindBody(body) < 0,"CCollisionBucket.AddBody(): FindBody( body [ " + body._name + " ] ) < 0");
- this.m_arrOverlappingBodies.push(body);
- body.NotifyAddedToBucket(this);
- }
- function FindBody(body)
- {
- var _loc3_ = this.m_arrOverlappingBodies.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- if(this.m_arrOverlappingBodies[_loc2_] == body)
- {
- return _loc2_;
- }
- _loc2_ = _loc2_ + 1;
- }
- return -1;
- }
- function RemoveBody(body)
- {
- var _loc2_ = this.FindBody(body);
- if(_loc2_ >= 0)
- {
- this.m_arrOverlappingBodies.splice(_loc2_,1);
- }
- }
- }
-